<template>
  <div class="search-panel">
    <el-row class="m-header-searchbar">
      <el-col
        :span="3"
        class="left">
        <img
          src="//s0.meituan.net/bs/fe-web-meituan/e5eeaef/img/logo.png"
          alt="美团">
      </el-col>
      <el-col
        :span="15"
        class="center">
        <div class="wrapper">
          <el-input
            v-model="search"
            placeholder="搜索"
            @focus="focus"
            @blur="blur"
            @input="input"
          />
          <button class="el-button el-button--primary"><i class="el-icon-search"/></button>
          <dl
            v-if="isHotPlace"
            class="hotPlace">
            <dt>搜索搜索</dt>
            <dd
              v-for="(item,index) of hotPlace"
              :key="index">{{ item }}
            </dd>
          </dl>
          <dl
            v-if="isSearchList"
            class="searchList">
            <dd
              v-for="(item,index) of searchList"
              :key="index">{{ item }}
            </dd>
          </dl>
        </div>
        <p class="suggset">
          <a href="">美团</a>
          <a href="">美团</a>
          <a href="">美团</a>
          <a href="">美团</a>
          <a href="">美团</a>
        </p>
        <ul class="nav">
          <li>
            <nuxt-link
              to="/haha"
              class="takeout">haha
            </nuxt-link>
          </li>
          <li>
            <nuxt-link
              to="/haha"
              class="movie">haha
            </nuxt-link>
          </li>
          <li>
            <nuxt-link
              to="/haha"
              class="hotel">haha
            </nuxt-link>
          </li>
          <li>
            <nuxt-link
              to="/haha"
              class="apartment">haha
            </nuxt-link>
          </li>
          <li>
            <nuxt-link
              to="/haha"
              class="apartment">haha
            </nuxt-link>
          </li>
        </ul>
      </el-col>
      <el-col
        :span="6"
        class="right">
        <ul class="security">
          <li><i class="refund"/>
            <p class="txt">美团美团</p>
          </li>
          <li><i class="single"/>
            <p class="txt">美团美团</p>
          </li>
          <li><i class="overdue"/>
            <p class="txt">美团美团</p>
          </li>
        </ul>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      search: '',
      isFocus: false,
      hotPlace: ['热搜1', '热搜2', '热搜3', '热搜4'],
      searchList: ['搜索1', '搜索2', '搜索3', '搜索4']
    }
  },
  computed: {
    isHotPlace() {
      return this.isFocus && !this.search
    },
    isSearchList() {
      return this.isFocus && this.search
    }
  },
  methods: {
    focus() {
      this.isFocus = true
    },
    blur() {
      let _this = this
      setTimeout(function() {
        _this.isFocus = false
      }, 200)
    },
    input() {
      console.log(111)
    }
  }
}
</script>
